package com.start_eternity.oasissafewalk.mapper;

import com.start_eternity.oasissafewalk.pojo.Station;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDate;
import java.util.List;

@Mapper
public interface StationMapper {

    //查询全部站点
    //@Select("select * from station")
    List<Station> list(String stationName, Short stationStatus, LocalDate begin, LocalDate end);

    //新增站点
    @Insert("insert into station " +
            "(station_name, station_des, province, city, station_address, longitude, latitude, create_time, update_time) " +
            "values " +
            "(#{stationName}, #{stationDes}, #{province}, #{city}, #{stationAddress}, #{longitude}, #{latitude}, #{createTime}, #{updateTime})")
    void insert(Station station);

    //删除站点
    @Delete("delete from station where station_id = #{stationId}")
    void deleteById(Integer id);

    //获取站点id
    @Select("select * from station where station_id = #{stationId}")
    Station getById(Integer id);

    //修改站点
    void update(Station station);

    @Select("select * from station")
    List<Station> getStation();
}
